<%@page import="twitter4j.PagableResponseList"%>
<%@page import="twitter4j.Status"%>
<%@page import="twitter4j.UserList"%>
<%@page import="twitter4j.http.AccessToken"%>
<%@ page language="java" pageEncoding="UTF-8"%><%@
 taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %><%@
 page import="java.util.ArrayList"%>
<%@page import="twitter4j.User"%>
<%@page import="java.util.List"%>
<%@page import="twitter4j.IDs"%>
<%@page import="twitter4j.TwitterFactory"%>
<%@page import="twitter4j.Twitter"%><%
	try {
		String CONSUMER_KEY = "SYwJg523pWZPjL32xDMw";
		String CONSUMER_SECRET = "t9vE5tFYE8CCAyJE4i62kWeNG4UywJSwiJmu5ATYI";
		String token = (String)session.getAttribute("token");
		String tokenSecret= (String)session.getAttribute("tokenSecret");
		
		Twitter twitter= new TwitterFactory().getOAuthAuthorizedInstance(CONSUMER_KEY, CONSUMER_SECRET, new AccessToken(token,tokenSecret));
		PagableResponseList<User> myFriendList = twitter.getFriendsStatuses();

		request.setAttribute("myFriendList", myFriendList);		
	} catch (Exception e) {
		e.printStackTrace();
	}
%>
<html>
<head>
	<title>Your Followings</title>
	<style type="text/css">
		.underLine {
			border-color: gray;
			border-bottom-style: solid;
			border-bottom-width: 1px;
			vertical-align: top;
			text-align: left;
			
		}
	</style>
</head>
<body>
	<h1>Your Followings!</h1>
	<table style="width:100%; border-collapse: collapse;">
	<c:forEach items="${requestScope.myFriendList}" var="friend">
		<tr>
			<td style="width:30px" class="underLine">
				<img src="<c:out value="${friend.profileImageURL}" />"></img>	
			</td>
			<td class="underLine">
				${friend.screenName}<br/>
				${friend.name}<br/>
				${friend.status.text}<br/>
				${friend.status.createdAt}
			</td>
		</tr>
	</c:forEach>
	</table>	
</body>
</html>